public class Animal {
    private String name;
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public Animal(String name){
        this();
    }
    public Animal(){
        this.name="Someone";
    }
    public void eat(){
        System.out.println(this.name+" 吃饭");
    }

    public static void main(String[] args) {
        Animal animal1 = new Animal();
        System.out.println(animal1.getName());
        animal1.setName("dog");
        animal1.eat();
        System.out.println(animal1.getName());
        Animal animal2 = new Animal("dog");
        System.out.println(animal2.getName());
    }
}